﻿@using Newtouch.Infrastructure;
@{
    ViewBag.Title = "住院发药统计";
    Layout = "~/Views/Shared/_Index.cshtml";
    var reportUrl = Newtouch.Core.Common.Utils.ConfigurationHelper.GetAppConfigValue("ReportUrl");
    var reportSystemCode = Newtouch.Core.Common.Utils.ConfigurationHelper.GetAppConfigValue("ReportSystemCode");
}
<style>
    #btn_print {
        background-color: #fff;
        color: #00a9ea;
        font-weight: bolder;
    }
</style>
<form id="form1">
    <div class="panel panel-default">
        <div class="panel-heading">搜索</div>
        <div>
            <table class="form">
                <tr>
                    <th class="formTitle ">统计日期:</th>
                    <td class="formValue">
                        <input id="startTime" type="text" class="form-control input-wdatepicker " value="@DateTime.Now.ToString("yyyy-MM-dd 00:00:00")" on onfocus="WdatePicker({ dateFmt: 'yyyy-MM-dd HH:mm:ss' })" />
                    </td>
                    <th class="formTitle">到：</th>
                    <td class="formValue">
                        <input id="endTime" type="text" class="form-control input-wdatepicker " value="@DateTime.Now.AddHours(1).ToString("yyyy-MM-dd HH:mm:ss")" on onfocus="WdatePicker({ dateFmt: 'yyyy-MM-dd HH:mm:ss' })" />
                    </td>
                    <th class="formTitle">病区：</th>
                    <td class="formValue formDdlSelectorTd">
                        <select id="bqmc" class="form-control">
                            <option value="">全部</option>
                        </select>
                    </td>
                    <th class="formTitle">药品定位：</th>
                    <td class="formValue">
                        <input id="keyword" type="text" class="form-control" />
                        <input id="ypcode" type="hidden" />
                    </td>
                    <td class="formTitle">
                        <input type="button" id="btn_search" class="btn btn-primary" value="查询" style="margin-left:10px;" />
                    </td>
                </tr>
            </table>
        </div>
    </div>
    <div class="ui-layout" id="dv_layout" style="width: 100%; height: 100%;">
        <iframe class="ui-layout-center" style="width:100%; height: 100%;" id="if_data" name="if_data" scrolling="auto" allowtransparency="true" frameborder="0"></iframe>
    </div>
</form>
<script>
    //初始化输入码
    function InitSrm() {
        //药品代码
        $("#keyword").newtouchBatchFloatingSelector({
            clickautotrigger: true,
            height: 200,
            width: 1130,
            url: '/Medicine/SelectLossAndProfitMedicineList',
            ajaxmethod: 'Get',
            ajaxreqdata: function () {
                var reqData = {};
                reqData.inputCode = $("#keyword").val();
                return reqData;
            },
            caption: "药品信息",
            colModel: [
                { label: '类别', name: 'yplb', width: 50 },
                { label: '名称', name: 'ypmc', width: 200, align: 'left' },
                { label: '库存', name: 'xykcstr', width: 70, align: 'right' },
                { label: '规格', name: 'ypgg', width: 150, align: 'center' },
                { label: '有效期', name: 'yxq', width: 80 },
                { label: '批号', name: 'ph', width: 110, align: 'center' },
                { label: '批次', name: 'pc', width: 140, align: 'center' },
                { label: '生产厂家', name: 'sccj', width: 220, align: 'center' },
                { label: '状态', name: 'ypzt', width: 50 },
                { label: '进价', name: 'jj', hidden: true },
                { label: '零售价', name: 'lsj', hidden: true },
                { label: '批发价', name: 'pfj', hidden: true },
                { label: '药库零售价', name: 'Yklsj', hidden: true },
                { label: '药库批发价', name: 'Ykpfj', hidden: true },
                { label: '代码', name: 'ypCode', hidden: true },
                { label: '转换因子', name: 'zhyz', hidden: true },
                { label: 'kcsl', name: 'kcsl', hidden: true },
                { label: 'zxdw', name: 'zxdw', hidden: true },
                { label: '单位', name: 'djdw', hidden: true }
            ],
            itemdbclickhandler: function ($thistr) {
                $("#ypcode").val($thistr.attr('data-ypCode'));
                $("#keyword").val($thistr.attr('data-ypmc'));
                return;
            }
        });

        $("#bqmc").bindSelect({ //病区信息集合
            url: "/HospitalizationPharmacy/GetBQSelectJson",
            id: "bqCode",
            text: "bqmc"
        });
    }

    $(function () {
        InitSrm();

        $('#if_data').css('height', $(window).height() - 85);
        //查询
        $("#btn_search").click(function () {

            if ($("#keyword").val() == "") {
                $("#ypcode").val("");
            }
            var orgId='@ViewBag.OrganizeId';
            var url = '@reportUrl' + "?tempCode=67" + "&systemCode=" + '@reportSystemCode' + "&orgId=" + orgId + "&yfbmCode=" + '@Constants.CurrentYfbm.yfbmCode'
                + "&kssj=" + $('#startTime').val() + "&jssj=" + $('#endTime').val() + "&bqCode=" + $("#bqmc").val() + "&searchCondition=" + $("#ypcode").val();
            @*var url =
                "../../Report/PrintReport?type=zyfytj&param=orgId=@ViewBag.OrganizeId|yfbmCode=@Constants.CurrentYfbm.yfbmCode" +
                    "|kssj=" +
                    $('#startTime').val() +
                    "|jssj=" +
                    $('#endTime').val() +
                    "|bqCode=" +
                    $("#bqmc").val() +
                    "|searchCondition=" +
                    $("#ypcode").val();*@
            $("#if_data").attr('src', url);
        });
        $("#btn_search").trigger("click");
    });

</script>